home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / batchut / reply1.zip / REPLY.DOC < prev    next >
Text File  |  1988-07-28  |  7KB  |  174 lines

  1.  
  2.  
  3.  
  4.                                 REPLY.COM
  5.  
  6.  
  7.  
  8.                       Created By:  Charles Thurston
  9.  
  10.  
  11.                            Of:  Sunnyvale, CA
  12.  
  13.  
  14.                               October 1987
  15.  
  16.  
  17.      This file contains the following:
  18.  
  19.           1)   A short description of the REPLY program.
  20.           2)   An example of its use in a .BAT file.
  21.           3)   A copy of the assembly program (REPLY.ASM).
  22.  
  23. ******************************************************************************
  24.      This program is FREE, however, if you find it useful, please make a
  25. contribution to any charity you wish, since that's where good money should go.
  26. ******************************************************************************
  27.  
  28. REPLY Description:
  29.  
  30.      I have seen several programs out there which let the user make decisions
  31. inside a .BAT process, and allow the user to change course in that process
  32. based on the outcome.  All of these programs have their good and bad points. 
  33. This program, REPLY.COM, combines what I consider to be all of their good
  34. points into one routine.
  35.  
  36.      REPLY has the following features:
  37.  
  38.           a)   REPLY's response parameters, those of which the user can choose
  39.                from, may be entered in any order.
  40.  
  41.           b)   If no valid response is received after 10 seconds, REPLY will
  42.                perform a DEFAULT response, which can also be used as a
  43.                parameter for the .BAT file to react upon.
  44.  
  45.           c)   While in the 10 second period, a response is entered which is
  46.                not valid, REPLY will ignore it and continue to wait for a
  47.                correct response of the end of the 10 second period.
  48.  
  49.           c)   All comments, to be used to prompt the user of his/her chooses,
  50.                are performed using "echo" statements prior to performing REPLY.
  51.  
  52.                Therefore, the decision prompt is not limited to one line.
  53.  
  54.           d)   REPLY accepts response parameters of 1-9 and a-z.
  55.  
  56.                1)   Allowing for a total of 35 possible chooses.
  57.  
  58.                2)   All letters, a-z, are converted to upper case, so "a" and
  59.                     "A" are considered the same response.  This allows the user
  60.                     the freedom of having the same response regardless of the
  61.                     "Shift" or "Caps Lock" condition of their machine at the
  62.                     time of their response.
  63.  
  64.  
  65.                                         1
  66.  
  67.           e)   REPLY checks the validity of all commend line parameters.  If
  68.                there are any invalid, missing, or duplicate response
  69.                parameters, REPLY will output an error message.
  70.  
  71.      REPLY parameters can be used in several ways. The following statements are
  72. examples of REPLY commands:
  73.  
  74.           REPLY 123456789abcdefghijklmnopqrstuvwxyz
  75. or
  76.           REPLY 123456789aBcDeFgHiJkLmNoPqRsTuVwXyZ
  77. or 
  78.           REPLY y
  79. or even something weird like this
  80.           REPLY 1a3E4g2W7z9X
  81.  
  82.      In a batch file after running REPLY, the "if errorlevel" command is used
  83. to check which response parameter was chosen.  The "if errorlevel" number to be
  84. tested for each response parameter is assigned soully by the order in which the
  85. parameters appear in the REPLY command line.  For example:
  86.  
  87.                          REPLY 123456789abcdefghijklmnopqrstuvwxyz
  88.                                |              |                  |
  89.                                |              |                  |
  90.      "if errorlevel" code:    "1"           "16"               "35"
  91.  
  92.      The "if errorlevel" code for the 10 second timeout is "0".
  93.  
  94. Note:     When using the "if errorlevel" batch command, the number tests must
  95.           always be checked in descending order, since the "if errorlevel" is
  96.           "True" if the test is "Greater than or equal".
  97. ******************************************************************************
  98.  
  99. Example Of Using REPLY In A .BAT File
  100.  
  101.      An example of using REPLY in a .BAT file follows:
  102.  
  103. AUTOEXEC.BAT
  104.  
  105. echo off
  106. echo ************************************************************
  107. echo * ABORT TO DOS?            (10 seconds to decide)          *
  108. echo *                                                          *
  109. echo * Chooses:  Y(yes) / N(no)  or TIMEOUT @ End Of 10 Seconds *
  110. echo ************************************************************
  111. reply yn
  112. if errorlevel 2 goto CONTINUE
  113. if errorlevel 1 goto EXIT
  114. rem  **** continue with default option ****
  115. ....(1).......
  116. ............
  117. ..........
  118. ........
  119. goto EXIT
  120. :CONTINUE
  121. ....(2).......
  122. ............
  123. ..........
  124. ........
  125. :EXIT
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                                         2
  132.  
  133. When this batch file is performed, the following will appear on the screen:
  134.  
  135. ************************************************************
  136. * ABORT TO DOS?            (10 seconds to decide)          *
  137. *                                                          *
  138. * Chooses:  Y(yes) / N(no)  or TIMEOUT @ End Of 10 Seconds *
  139. ************************************************************
  140. RESPONSE: . . . . .
  141.  
  142. at which time a response may be entered.  Another "." will appear each second
  143. until a correct response of either "y" of "n" is entered, or the 10 seconds
  144. elapses.  If "n" is entered, an "N" will appear on the "RESPONSE" line, the
  145. batch file will perform process (2) and exit.  If "y" is entered, a "Y" will
  146. appear and the batch file will exit.  If the 10 second timeout occurs,
  147. "DEFAULT" will appear, process (1) will be performed and exit.
  148. ******************************************************************************
  149.  
  150.  
  151. REPLY.ASM Listing
  152.  
  153.      For those of you who may wish to modify, or use portions of this routine
  154. for other purposes, The following is the assembly program from which REPLY was
  155. produced, and you're welcome to it.
  156.  
  157. [Toad Hall Note:
  158.  Removed the assembler source from this document and included it as a
  159.  separate REPLY.ASM file.
  160.  Extracted and tested a demo .BAT file (REPLYDEM.BAT) to test REPLY1.COM.
  161.  (Change the "reply1 yn" in that file to "reply yn" to test REPLY.COM.
  162.  Did a severe hack on REPLY.ASM:
  163.    - Removed some awkward code, tightened up things in general.
  164.    - Removed CPU speed-dependent timing loops (now using DOS master clock
  165.      ticks),
  166.    - Fixed up format and code to agree with MASM 5.0 (but didn't use the
  167.      "short" segment stuff, so it should still compile with earlier MASMs).
  168.    - Shortened .COM by about 40 bytes or so.
  169.    - Improved code included as REPLY1.ASM.
  170.    - Improved compiled program included as REPLY1.COM
  171.  David Kirschbaum, Toad Hall, 10 Jan 88, 28 Jul 88
  172.  kirsch@braggvax.ARPA
  173. ]
  174.